package filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpFilter;

/**
 * Servlet Filter implementation class ABCFilter
 */
@WebFilter(filterName="BCDFilter")
public class BCDFilter extends HttpFilter implements Filter {
       
	 public BCDFilter() {
	        super();
	        System.out.println("BCDfilter 的构造方法被执行");
	    }

	    public void destroy() {
	        System.out.println("BCDfilter 的销毁方法被执行");
	    }

	    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
	        // place your code here

	        System.out.println("doFilter 前的代码");
	        // pass the request along the filter chain
	        chain.doFilter(request, response);
	        System.out.println("doFilter 后的代码");
	    }

	    public void init(FilterConfig fConfig) throws ServletException {
	        System.out.println("filter 的初始化方法");
	    }

	}